<?php
/**
 * Created by littleU.
 * User: littleU
 * Date: 2021-01-29
 * Time: 11:27
 */

namespace app\api\model;


use app\lib\exception\ParameterException;
use think\Model;

class BaseModel extends Model
{
    protected $autoWriteTimestamp = true;
    public function add($data)
    {
        if(!is_array($data))
        {
            throw new ParameterException([
                'msg' => '传递数据不合法'
            ]);
        }
        $this->allowField(true)->save($data);
        return $this->getAttr('id');
    }
}